{include file="public/layout" /}
{include file="gzh/header" /}

<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="canal/left" /}
<div class="page min-hg-c-10" style="min-width:auto;margin-left:100px;">

    <div class="fixed-bar">
        <div class="item-title">
            <a class="back_xin" href="{:url('Gzh/material_list_text')}" title="返回"><i class="iconfont e-fanhui"></i></a>
            <div class="subject">
                <h3>新增文字素材</h3>
                <h5></h5>
            </div>
        </div>
    </div>    
    <form class="form-horizontal" id="post_form" action="" method="post" enctype="multipart/form-data">
        <div class="ncap-form-default">
            <dl class="row dl_row" id="dl_text">
                <dt class="tit">
                    <label for="text"><em>*</em>文本内容</label>
                </dt>
                <dd class="opt ui-text">
                    <textarea rows="5" cols="80" id="text" name="intro" style="height:200px;" placeholder="" class="ui-input" data-num="600"></textarea>
                    <p class="notic">（<span class="ui-textTips">还可以输入600个字</span>）</p>
                </dd>
            </dl>
            <div class="bot mt30">
                <a href="JavaScript:void(0);" onclick="formSubmit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">保存</a>
            </div>
        </div>
    </form>
</div>
<script>
    function formSubmit(){
        layer_loading('正在处理');
        var url = "{:url('Gzh/material_text_add')}";
        $.ajax({
            type: 'POST',
            url: url,
            data: $("#post_form").serialize(),
            dataType: 'json',
            success: function(res) {
                layer.closeAll();
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1, time:1000}, function(){
                        location.href = "{:url('Gzh/material_list_text')}";
                    });
                } else {
                    layer.msg(res.msg);
                }
            },
            error:function (e) {
                layer.alert(e.responseText);
            }
        });
    }
</script>
{include file="public/footer" /}